/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.fl.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 评价表Entity
 * @author anthony
 * @version 2019-01-08
 */
@Table(name="fl_evaluate", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="appointment_id", attrName="appointment.id", label="预约Id"),
		@Column(name="type", attrName="type", label="类型"),
		@Column(name="score", attrName="score", label="分值"),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class Evaluate extends DataEntity<Evaluate> {
	
	private static final long serialVersionUID = 1L;
	private Appointment appointment;		// 预约
	private String type;		// 类型
	private Integer score;		// 分值
	
	public Evaluate() {
		this(null);
	}

	public Evaluate(Appointment appointment){
		this.appointment = appointment;
	}
	
	@NotBlank(message="类型不能为空")
	@Length(min=0, max=100, message="类型长度不能超过 100 个字符")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
	
	@NotNull(message="分值不能为空")
	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}
	
	public String getType_gte() {
		return sqlMap.getWhere().getValue("type", QueryType.GTE);
	}

	public void setType_gte(String type) {
		sqlMap.getWhere().and("type", QueryType.GTE, type);
	}
	
	public String getType_lte() {
		return sqlMap.getWhere().getValue("type", QueryType.LTE);
	}

	public void setType_lte(String type) {
		sqlMap.getWhere().and("type", QueryType.LTE, type);
	}

	public Appointment getAppointment() {
		return appointment;
	}

	public void setAppointment(Appointment appointment) {
		this.appointment = appointment;
	}
}